<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="format-detection" content="telephone=no" />
		<meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
		<script src="../../script/mui.min.js"></script>
		<script src="../../script/jquery.min.js"></script>
		<link rel="stylesheet" href="../../css/mui.min.css" />
		<link rel="stylesheet" href="../../css/CFNetPP_Base.css">
		<link rel="stylesheet" type="text/css" href="../../css/weui.min.css">
		<link rel="stylesheet" href="../../css/base.css"/>
		<link rel="stylesheet" href="../../css/personal.css">
		<link rel="stylesheet" href="../../css/exam.css">
		<link rel="stylesheet" href="../../css/swiper-3.4.2.min.css">
		<link rel="stylesheet" href="../../css/courseTest.css">
		<title>老师端课程考核已批改详情页</title>
		<script type="text/javascript" charset="utf-8">
			mui.init();
		</script>
		<style>
			.swiper-wrapper {
				min-height: 450px
			}
			.stu-test .mui-btn-primary {
				color: #fff;
				background-color: #FF9900;
				border: 1px solid #FF9900;
				padding-left: 2em;
				padding-right: 2em;
			}
			.questionItemImgDiv {
				height: 12em;
				width: 80%;
				max-height: 14em;
				max-width: 95%;
				margin-left: 13px;
			}
			.xuanzeImgDiv {
				width: 80%;
				height: 8em;
				max-height: 10em;
			}
			.tiankong {
				font-family: inherit;
				border-bottom: 1px solid #000;
				margin: 0 8px;
				text-align: center;
				width: auto;
				/*word-break:break-all*/
			}
			.question_video_div {
				padding: 10px 10px;
				padding-left: 20px;
			}
			.question_video_div	video {
				width: 100%;
				height: 13em;
				background-color: black;
			}
			.question_video_div	img {
				width: 100%;
				height: 10em;
				background-color: black;
			}
			.option_video_div {
				padding: 10px 10px;
				padding-left: 55px;
			}
			.option_video_div	img {
				width: 100%;
				height: 8em;
				background-color: black;
			}
			.option_video_div	video {
				width: 100%;
				height: 12em;
			}
		</style>
	</head>
	<body >
		<div class="stu-test" id="scroll">
			<div class="base_style_color" id='BarAppearance' style="height: 22px;width: 100%; position:fixed; left: 0px;top:0px;z-index: 998" ></div>
			<div class="base_navigation_bar base_style_color base_navigation_item_bar" style="position: fixed;left: 0px;top: 20px;">
				<a class="base_left_item" href="#" onclick="backTestToast()"> <img class="base_back_icon" src="../../image/icon_jiantou.png" alt=""> </a>
				<span id="title"></span>
			</div>
			<div class="space10 top_44"></div>
			<div class="k-con test-m-bottom70 test-analysis" id="question_div">
				<div class="swiper-container">
					<div class="swiper-wrapper" ></div>
				</div>
			</div>
			<div class="k-con1 k-text-center k-fixed-bottom test-bottom1" id="sub_bt">
				<div class="k-con-part1">
					<span class="test-score-detail2"> 学生分数：<span class="k-cred" id="score" ></span>分 </span>
				</div>
				<div class="test_card_div2">
					<a class="base_right_item "style="color: #18B4ED" href="#popover-card">答题卡 </a>
				</div>
			</div>
			<div id="popover-card" class="mui-popover test-num-card" style=" width: 97% ;">
				<div class="mui-scroll-wrapper">
					<div class="mui-scroll" id="scroll-card"></div>
				</div>
			</div>
			<div id="offlineAlert" class="weui_dialog_confirm" style="display: none;">
				<div class="weui_mask"></div>
				<div class="weui_dialog" >
					<div class="weui_dialog_hd">
						<strong class="weui_dialog_title" id="checkNum"></strong>
					</div>
					<div class="weui_dialog_bd"></div>
					<div class="weui_dialog_ft">
						<a onclick="cleanCancel()" href="#" class="weui_btn_dialog default"  style="color:#18b4ed">取消</a>
						<a onclick="cleanConfirm()" href="#" class="weui_btn_dialog primary"  style="color:#18b4ed">确定</a>
					</div>
				</div>
			</div>
			<div class="weui_dialog_alert" id="closeAlert" style="display: none;">
				<div class="weui_mask"></div>
				<div class="weui_dialog" >
					<div class="weui_dialog_hd">
						<strong class="weui_dialog_title" id="checkNum2"></strong>
					</div>
					<div class="weui_dialog_ft">
						<a onclick="Cancel()" href="#" class="weui_btn_dialog primary"  style="color:#18b4ed">确定</a>
					</div>
				</div>
			</div>
		</div>
	</body>
	<script type="text/javascript" src="../../script/api.js"></script>
	<script src="../../script/jquery.min.js" type="text/javascript"></script>
	<script type="text/javascript" src="../../script/MD5.js"></script>
	<script src="../../script/common.js"></script>
	<script src="../../script/swiper-3.4.2.jquery.min.js" type="text/javascript"></script>
	<script type="text/javascript" src="../../script/requestTool.js"></script>
	<script type="text/javascript" src="../../script/courseTest.js"></script>
	<script type="text/javascript" src="../../script/attachmentManager.js"></script>
	<script type="text/javascript">
		var daan = new Object();
		//题目名称数组
		var itemNameArr = new Array();
		var pid = "";
		// 计划id
		var cid = "";
		//课程id
		var chapterid = "";
		//章节id
		var tid = "";
		var stime = "";
		var json_jieguo = new Object();
		var Subjective_questionLen = '';
		var Objective_questionLen = '';
		var questionLen = '';
		var qidArr = new Array();
		var clickNum = "";
		//最多考核次数
		var e_big_exam = 1;
		//考核完是否显示成绩
		var e_display_cj = 1;
		//是否显示答案
		var e_display_da = 1;
		apiready = function() {
			sendBuriedNotifi('0', '老师端课程考核已批改详情页', '077');
			var h = api.winHeight * 0.3;
			$('#popover-card').css('height', h);
			var pageParam = api.pageParam;
			$('#title').text(api.pageParam.rename);
			$('#score').text(api.pageParam.score);
			showProgress();
			//			getExamInfo();
			//获取数据
			loadTestExamScoreData();
			scrollUI();
		}
		function sendBuriedNotifi(busionessid, pagetype, pagetypeid) {
			var userinfo = {
				uid : $api.getStorage('cfnetppuid'),
				jid : $api.getStorage('cfnetppjxid'),
				uname : $api.getStorage('cfnetppusername'),
				exam_id : api.pageParam.examid,
				sid : api.pageParam.score_id,
			}
			var data = {
				busionessid : busionessid,
				pagetype : pagetype,
				pagetypeid : pagetypeid,
				sourceurl : api.pageParam.sourceurl,
				sourcetitle : api.pageParam.sourcetitle,
				accesspageurl : window.location.pathname,
				accesspagetitle : document.title,
				userinfo : userinfo
			}
			SendBehaviorTrajectoriesNotifi_Study(data);
		}

		//获取课程考试基本信息
		function getExamInfo() {
			var param = {
				exam_id : api.pageParam.examid,
			};
			cfnetppPOST(url_getCourseExamInfo, param, false, function(data, status) {
				if (status == 'success') {
					if (data.code == 200) {
						var list = data.data;
						if (list != null && list != '') {
							timeNum = parseInt(list.dtime) * 60;
							e_big_exam = parseInt(list.e_big_exam);
							//考核完是否显示成绩
							e_display_cj = parseInt(list.e_display_cj);
							//是否显示答案
							e_display_da = parseInt(list.e_display_da);
						} else {
							back('当前章节数据为空');
							clickNum = 3;
						}
					} else if (data.code == 128) {
						back('当前章节数据为空');
						clickNum = 3;
					} else {
						back('数据异常');
						clickNum = 3;
					}
				} else {
					api.toast({
						msg : '网络异常',
						duration : 2000,
						location : 'bottom'
					});
				}
			});
		}

		//考试题目结果接口
		function loadTestExamScoreData() {
			var param = {
				exam_id : api.pageParam.examid,
				sid : api.pageParam.score_id,
				user_id : api.pageParam.user_id,
			};
			cfnetppPOST(url_getCourseExamjiuguo, param, false, function(data, status) {
				hideProgress();
				if (status == 'success') {
					if (data.code == 200) {
						var list = data.data;
						if (list != null) {
							var examList = GetHtmlTestArrayList(list);
							if (examList != '') {
								SetExamScoreDataUI(examList);
							} else {
								back('考试题目为空');
								clickNum = 3;
							}
						} else {
							back('考试题目为空');
							clickNum = 3;
						}
					} else if (data.code == 116) {
						back('考试次数达到上限');
						clickNum = 3;
					} else if (data.code == 111) {
						back('已过期');
						clickNum = 3;
					} else if (data.code == 110) {
						back('未开始');
						clickNum = 3;
					} else {
						back('数据异常');
						clickNum = 3;
					}
				} else {
					api.toast({
						msg : '网络异常',
						duration : 2000,
						location : 'bottom'
					});
				}
			});
		}

		//考试结果页html拼接
		function SetExamScoreDataUI(list) {
			var qxuan = '';
			var data = list;
			questionLen = data.length;
			var qdaanStr = '';
			var OrderNumStr = "";
			var xuanzeStr = "";
			var questionStr = "";
			var scoreStr = "";
			//	生成答题卡题号
			popoverCardNum(questionLen);
			for (var i = 0; i < questionLen; i++) {
				if (data[i] != null && data[i] != '') {
					qxuan = qxuanxiangIsNull(data[i].qxuanxiang);
					var userchoose = '';
					$(".swiper-wrapper").append('<div class="swiper-slide" id="item' + (i + 1) + '" itemtype="' + data[i].qtype + '"></div>')
					if (data[i].user_answer == null || data[i].user_answer == "") {
						$("#scroll-card").find("span").eq(i).removeClass('qusetion-num-selected').addClass('qusetion-num-normal');
					}
					questionStr = data[i].qtype != 11 ? questionsImgIsNull(data[i].questions) : FillInBlankQuestionStr(data[i]);
					if (data[i].qtype == 1 || data[i].qtype == 3 || data[i].qtype == 8) {
						if (e_display_da == 2) {//显示正确答案::
							if (data[i].user_answer == DanqdaanNull(data[i].qdaan, data[i].qjiexi)) {//答案正确
								qdaanStr = '<p class="k-cred">' + "正确答案:" + DanqdaanNull(data[i].qdaan, data[i].qjiexi) + '</p>'
								$("#scroll-card").find("span").eq(i).removeClass('qusetion-num-normal').addClass('qusetion-num-true');
							} else {
								qdaanStr = '<p class="k-cred">' + "正确答案:" + DanqdaanNull(data[i].qdaan, data[i].qjiexi) + '</p>'
								$("#scroll-card").find("span").eq(i).removeClass('qusetion-num-normal').addClass('qusetion-num-false');
							}
						} else {
							if (data[i].user_answer == DanqdaanNull(data[i].qdaan, data[i].qjiexi)) {//答案正确
								qdaanStr = ''
								$("#scroll-card").find("span").eq(i).removeClass('qusetion-num-normal').addClass('qusetion-num-true');
							} else {
								qdaanStr = ''
								$("#scroll-card").find("span").eq(i).removeClass('qusetion-num-normal').addClass('qusetion-num-false');
							}
						}
						$("#item" + (i + 1)).append('<div class="k-con-part3 clearfix">' + '<span id="itemType" class="k-f18">' + ByIdGetQuestionTypeName(data[i].qtype) + '</span>' + '<p class="k-f16 k-c323 k-mt5 indent-5">' + (i + 1) + "." + "(" + data[i].qfenshu + "分 " + ")" + questionStr + '</p>' + qdaanStr + '<div class="test-answer-list left_10" >' + '</div>' + '</div>')
						//	是单选或判断
						for (var k = 0; k < qxuan.length; k++) { z
							xuanzeStr = xuanzheImgIsNull(qxuan[k].xuanzhe);
							if ((k + 1 ) != charCodeAt(data[i].user_answer)) {
								$("#item" + (i + 1) + " .test-answer-list").append('<div class="mui-input-row mui-radio mui-left " >' + xuanzeStr + '<input dataindex="' + (k + 1) + '"  onclick="return false;"   name="radio' + data[i].qid + '" type="radio"   itemid="' + data[i].qid + '">' + '</div> ')
							} else {
								$("#item" + (i + 1) + " .test-answer-list").append('<div class="mui-input-row mui-radio mui-left " >' + xuanzeStr + '<input dataindex="' + (k + 1) + '"  checked="checked"  onclick="return false;"   name="radio' + data[i].qid + '" type="radio"   itemid="' + data[i].qid + ' checked="checked" ">' + '</div> ')
							}
						}
					} else if (data[i].qtype == 2||data[i].qtype == 9) {//多选题
						var qdaanArr = DuoqdaanNull(data[i].qdaan, data[i].qjiexi);
						var keys1 = [];
						keys1 = getCjjieguoKey(data[i].user_answer);
						var userchooseLetter = [];
						for (var j = 0; j < keys1.length; j++) {
							userchooseLetter.push(charCodeAt(keys1[j]))
						}
						if (e_display_da == 2) {//显示正确答案::
							if (keys1.toString() == qdaanArr.toString()) {//答案正确
								qdaanStr = '<p class="k-cred left_10">' + "正确答案:" + DuoqdaanNull(data[i].qdaan, data[i].qjiexi);
								+'</p>'
								$("#scroll-card").find("span").eq(i).removeClass('qusetion-num-normal').addClass('qusetion-num-true');
							} else {
								$("#scroll-card").find("span").eq(i).removeClass('qusetion-num-normal').addClass('qusetion-num-false');
								qdaanStr = '<p class="k-cred left_10">' + "正确答案:" + DuoqdaanNull(data[i].qdaan, data[i].qjiexi);
								+'</p>'
							}
						} else {
							if (keys1.toString() == qdaanArr.toString()) {//答案正确
								qdaanStr = ''
								$("#scroll-card").find("span").eq(i).removeClass('qusetion-num-normal').addClass('qusetion-num-true');
							} else {
								$("#scroll-card").find("span").eq(i).removeClass('qusetion-num-normal').addClass('qusetion-num-false');
								qdaanStr = ''
							}
						}
						$("#item" + (i + 1)).append('<div class="k-con-part3 clearfix">' + '<span id="itemType" class="k-f18">' + ByIdGetQuestionTypeName(data[i].qtype) + '</span>' + '<p class="k-f16 k-c323 k-mt5 indent-5">' + (i + 1 ) + "、" + "(" + data[i].qfenshu + "分 " + ")" + questionStr + '</p>' + qdaanStr + '<div class="test-answer-list left_10" >' + '</div>' + '</div>')
						//	是多选
						for (var k = 0; k < qxuan.length; k++) {
							xuanzeStr = xuanzheImgIsNull(qxuan[k].xuanzhe);
							if (userchooseLetter.toString().indexOf(k + 1) == -1) {
								$("#item" + (i + 1) + " .test-answer-list").append('<div class="mui-input-row mui-checkbox mui-left" >' + xuanzeStr + '<input dataindex="' + (k + 1) + '" name="checkbox1"  onclick="return false;"    value="Item 1" type="checkbox"  itemid="' + data[i].qid + '">' + '</div>')
							} else {
								$("#item" + (i + 1) + " .test-answer-list").append('<div class="mui-input-row mui-checkbox mui-left" >' + xuanzeStr + '<input dataindex="' + (k + 1) + '"  checked="checked"   onclick="return false;"  name="checkbox1" value="Item 1" type="checkbox"  itemid="' + data[i].qid + '">' + '</div>')
							}
						}
					} else if (data[i].qtype == 7) {//识图题
						var qdaanArr = DuoqdaanNull(data[i].qdaan, data[i].qjiexi);
						var keys1 = [];
						keys1 = getCjjieguoKey(data[i].user_answer);
						var userchooseLetter = [];
						for (var j = 0; j < keys1.length; j++) {
							userchooseLetter.push(charCodeAt(keys1[j]))
						}
						if (e_display_da == 2) {//显示正确答案::
							if (keys1.toString() == qdaanArr.toString()) {//答案正确
								qdaanStr = '<p class="k-cred left_10">' + "正确答案:" + DuoqdaanNull(data[i].qdaan, data[i].qjiexi) + '</p>'
								$("#scroll-card").find("span").eq(i).removeClass('qusetion-num-normal').addClass('qusetion-num-true');
							} else if (userchooseLetter.toString() == "" || userchooseLetter.toString() == null) {
							} else {
								$("#scroll-card").find("span").eq(i).removeClass('qusetion-num-normal').addClass('qusetion-num-false');
								qdaanStr = '<p class="k-cred left_10">' + "正确答案:" + DuoqdaanNull(data[i].qdaan, data[i].qjiexi); +'</p>'
							}
						} else {
							if (keys1.toString() == qdaanArr.toString()) {//答案正确
								qdaanStr = ''
								$("#scroll-card").find("span").eq(i).removeClass('qusetion-num-normal').addClass('qusetion-num-true');
							} else if (userchooseLetter.toString() == "" || userchooseLetter.toString() == null) {
							} else {
								$("#scroll-card").find("span").eq(i).removeClass('qusetion-num-normal').addClass('qusetion-num-false');
								qdaanStr = ''
							}
						}
						$("#item" + (i + 1)).append('<div class="k-con-part3 clearfix">' + '<span id="itemType" class="k-f18">' + ByIdGetQuestionTypeName(data[i].qtype) + '</span>' + '<p class="k-f16 k-c323 k-mt5 indent-5">' + (i + 1 ) + "、" + "(" + data[i].qfenshu + "分 " + ")" + questionStr + '</p>' + qdaanStr + '<div class="test-answer-list left_10" >' + '</div>' + '</div>')
						for (var k = 0; k < qxuan.length; k++) {
							var xuanzeStr = "";
							var inputStr = "";
							xuanzeStr = xuanzheImgIsNull(qxuan[k].xuanzhe);
							if (userchooseLetter.toString().indexOf(k + 1) == -1) {
								inputStr = '<input dataindex="' + (k + 1) + '" name="checkbox1"  onclick="return false;"    value="Item 1" type="checkbox"  itemid="' + data[i].qid + '">'
							} else {
								inputStr = '<input dataindex="' + (k + 1) + '"  checked="checked"   onclick="return false;"  name="checkbox1" value="Item 1" type="checkbox"  itemid="' + data[i].qid + '">'
							}
							$("#item" + (i + 1) + " .test-answer-list").append('<div class="mui-input-row mui-checkbox mui-left" >' + xuanzeStr + inputStr + '</div>')
						}
					} else if (data[i].qtype == 4 || data[i].qtype == 10) {//论述题和案例分析题
						var pingfenStr = '';
						if (data[i].user_answer == LunshuqdaanNull(data[i].qdaan, data[i].qjiexi)) {//答案正确
							qdaanStr = '<p class="k-cred left_10">' + "正确答案:" + LunshuqdaanNull(data[i].qdaan, data[i].qjiexi) + '</p>'
							$("#scroll-card").find("span").eq(i).removeClass('qusetion-num-normal').addClass('qusetion-num-true');
						} else {
							$("#scroll-card").find("span").eq(i).removeClass('qusetion-num-normal').addClass('qusetion-num-false');
							qdaanStr = '<p class="k-cred left_10">' + "正确答案:" + LunshuqdaanNull(data[i].qdaan, data[i].qjiexi) + '</p>'
						}
						pingfenStr = '<div class="mui-input-row pingfen"style="margin-top: 23px">' + '<label>评分:' + '</label>' + ' <span style="color: red">' + data[i].score + '分' + '</span>' + '</div>'
						$("#item" + (i + 1)).append('<div class="k-con-part3 clearfix">' + '<span id="itemType" class="k-f18">' + ByIdGetQuestionTypeName(data[i].qtype) + '</span>' + '<p class="k-f16 k-c323 k-mt5 indent-5">' + (i + 1 ) + "." + "(" + data[i].qfenshu + "分 " + ")" + questionStr + '</p>' + qdaanStr + '<div class="test-answer-list left_10" >' + '</div>' + '</div>' + pingfenStr)
						// 论述
						$("#item" + (i + 1) + " .test-answer-list").append('<div class="test-answer-list">' + '<textarea  class="k-texttarea k-f14" readonly="readonly"    id="content" itemid="' + data[i].qid + '">' + isStringNull(data[i].user_answer) + '</textarea>' + '</div>')
					} else if (data[i].qtype == 5) {//上传题
						$("#item" + (i + 1)).append('<div class="k-con-part3 clearfix">' + '<span id="itemType" class="k-f18">' + ByIdGetQuestionTypeName(data[i].qtype) + '</span>' + '<p class="k-f16 k-c323 k-mt5 indent-5">' + (i + 1) + "." + "(" + data[i].qfenshu + "分 " + ")" + questionStr + '<p class="k-cred left_10">' + "移动端暂不支持上传题，请在PC端查看！" + '</p>' + '</p>' + '<div class="test-answer-list left_10"  onclick="GetAnswerData(' + i + ')"  onclick="return false;" itemtype="' + data[i].qtype + '">' + '</div>' + '</div>')
					} else if (data[i].qtype == 11) {
						var user_answer = data[i].user_answer.split('|');
						qdaanStr = JudgeQuestionCorrectMessage(data[i], e_display_da, i);
						$("#item" + (i + 1)).append('<div class="k-con-part3 clearfix">' + '<span id="itemType" class="k-f18">' + ByIdGetQuestionTypeName(data[i].qtype) + '</span>' + '<p class="k-f16 k-c323 k-mt5 indent-5">' + scoreStr + questionStr + '</p>' + qdaanStr + '<div class="test-answer-list left_10" >' + '</div>' + '</div>');
						$.each(user_answer, function(k, e) {
							$("#item" + (i + 1)).find('.tiankong:eq(' + k + ')').attr("value", e)
							$("#item" + (i + 1)).find('.tiankong:eq(' + k + ')').attr("readonly", "readonly");
						});
					}
				} else {
					//设置初始题目标题
					$(".swiper-wrapper").append('<div class="swiper-slide" id="item' + (i + 1) + '" ></div>')
					$("#item" + (i + 1)).append('<div class="k-con-part clearfix tont" >' + '<p class="k-f16 k-c323 k-mt15">' + (i + 1) + "、" + '本题为空' + '</p>' + '<div  class="test-answer-list"      onclick="GetAnswerData(' + i + ')" >' + '</div>' + '</div>')
				}
			}
			var mySwiper = new Swiper('.swiper-container', {
				autoHeight : true,
				autoplayDisableOnInteraction : false,
				direction : 'horizontal',
				loop : false,
			})
			// 点击答题卡切换
			$("#popover-card span").on("click", function() {
				var index = $(this).index();
				mySwiper.slideTo(index, 1000, false);
				mui('#popover-card').popover('hide')
			});
		}

		//	生成答题卡题号
		function popoverCardNum(questionLen) {
			for (var i = 0; i < questionLen; i++) {
				$("#scroll-card").append('<span class="qusetion-num-normal">' + (i + 1) + '</span>')
			}
		}

		//退出考试提示
		function backTestToast() {
			sendBuriedNotifi('1', '老师端课程考核批改详情页', '077');
			if (clickNum == 3) {
				api.closeWin({
				});
			} else {
				api.closeWin({
				});
			}
		}

		function cleanCancel() {
			$('#offlineAlert').hide();
		}

		//确定
		function cleanConfirm() {
			$('#offlineAlert').hide();
			if (clickNum == 1) {
				showProgress();
			} else if (clickNum == 2) {
				backClick();
			}
		}
	</script>
</html>